package top.continew.admin.controller.business;

import cn.shengchao.examstar.rpc.knowledge.api.IKnowledgeRpc;
import cn.shengchao.examstar.rpc.knowledge.resp.KnowledgePointTag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 知识点 API
 *
 * @author sheng_chao
 * @since 2025/03/06 20:02
 */
@Tag(name = "知识点 API")
@RestController
@RequestMapping("/knowledge")
public class KnowledgeController {

    @DubboReference
    private IKnowledgeRpc iKnowledgeRpc;

    @GetMapping("{id}/tags")
    @Operation(summary = "获取知识点标签列表", description = "获取知识点标签列表")
    public List<KnowledgePointTag> getKnowledgePointTagList(@PathVariable Long id) {
        return iKnowledgeRpc.getKnowledgePointTagList(id);
    }

    @PostMapping("{id}/tags")
    @Operation(summary = "保存知识点", description = "保存知识点")
    public void saveKnowledge(@PathVariable Long id, @RequestBody List<KnowledgePointTag> tags) {

        iKnowledgeRpc.bindKnowledgePointTag(id, tags);
    }


}
